package com.tccmeta.matchmaker.config;

import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author jyhgfefe
 */
@Configuration
public class WechatConfig {

    public static String appId = "wx7a5d21131e4696b3";
    public static String secret="0b4b82441ca270c507befa6e1478e42c";
    public static String token="vxZ4wisZdsBdRRdDdTXDHtZ4tsTBDDd0";
    public static String accessToken;

    /**
     * 初始化微信service
     *
     * @return
     */
    @Bean
    public WxMpService getWxMpService() {
        WxMpService wxMpService = new WxMpServiceImpl();
        WxMpInMemoryConfigStorage wxMpInMemoryConfigStorage = new WxMpInMemoryConfigStorage();
        wxMpInMemoryConfigStorage.setAppId(appId);
        wxMpInMemoryConfigStorage.setSecret(secret);
        wxMpInMemoryConfigStorage.setToken(token);
        wxMpInMemoryConfigStorage.setAccessToken(accessToken);
        wxMpService.setWxMpConfigStorage(wxMpInMemoryConfigStorage);
        return wxMpService;
    }
}
